import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/auth/userInfo',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}


export default{
  getUserById(page, size, searchUser) {
    return request({
      url: '/system/user/list/' + page + "/" + size,
      method: 'get',
      params: searchUser
    })
  },

  changeUserStatus(status, id){
    return request({
      url: `/system/user/updateUserStatus/${status}/${id}`,
      method: 'get'
    })
  },
  
  updateUserById(userInfo){
    return request({
      url: `/system/user/updateUserById`,
      method: 'post',
      data: userInfo
    })
  },

  deleteUserById(id){
    return request({
      url: `/system/user/deleteUserById/${id}`,
      method: 'delete'
    })
  }

}
